-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(chatform): sanitize the toxstring to remove characters after the \0 #513
base: master
Are you sure you want to change the base?
Conversation
Tip Preview URL: https://deploy-preview-513--qtox.netlify.app |
893ec25
to
c11e1b1
Compare
I don't think we should do this. Getting this right is tricky, because as implemented in this PR, this allows users to add secret messages behind a \0 that only some clients can read and qTox hides from its users. That's particularly relevant in group chats. |
Yes, that sounds right. But how we should handle the TRIFA messages as they will merely always contain symbols after \0? Or may be, we can create an option in UI? |
Yeah, and maybe we can find out what format it's sending and make that option more specific so it filters out trifa stuff, not just anything after \0. Also we should still display something (like a coloured [...] to let users know there's something there. Then when the user disables the option (and restarts), the text should be there again, similar to the style options. |
c11e1b1
to
775babb
Compare
775babb
to
4cae55a
Compare
4cae55a
to
65e4a82
Compare
65e4a82
to
8102572
Compare
8102572
to
8917484
Compare
8917484
to
ae14b2e
Compare
I have added the new option and corresponding tests, sorry it took so long :) |
<property name="text"> | ||
<string>Chat log:</string> | ||
<string>Hide TRIfA suffix</string> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it actually TRIfA-specific? Can we call it something more generic, like post-null suffix or something?
In Qt6 when we convert QByteArray to string, \0 is considered as a valid character and do not end the string. Some messengers as TRIfA may provide additional information after the 0-th symbol, resulting in unexpected output of non readable symbols.
By default TRIfA v3 message will have the next structure:
message
2 bytes \0 (guard)
32 bytes of random values
4 bytes timestamp
See source
In This PR we are adding option to hide this line, or show it (the content of the line is saved in chat history).
This change is